package de.bastian.hinterleitner.tools;




public class Category extends DataBaseEntry implements Comparable<Category>{
	public String name;
	public String icon;
	public int id;
	public Category(String name, String icon, int id){
		this.name = name;
		this.icon = icon;
		this.id = id;
	}
	@Override
	public String toString() {
		return name;
	}
	@Override
	public int compareTo(Category arg0) {
		return name.compareTo(arg0.name);
	}
	@Override
	public boolean equals(Object o) {
		if( o instanceof Category ){
			Category c = (Category)o;
			if(id == -1 || c.id == -1){
				return toString().equals(o.toString());
			}else{
				return id == c.id;
			}
		}else{
			return toString().equals(o.toString());
		}
	}
}
